//
//  XFNetWorkManager.m
//  名医通
//
//  Created by zyc on 16/7/12.
//  Copyright © 2016年 mr.zhou. All rights reserved.
//

#import "XFNetWorkManager.h"
#import <MJExtension.h>
#import "XFDiseaseSubdivisionModel.h"

@implementation XFNetWorkManager

+ (instancetype)shareManager {

    static dispatch_once_t onceToken;
    static XFNetWorkManager *shareManager;
    dispatch_once(&onceToken, ^{
        
        shareManager = [[XFNetWorkManager alloc] init];
        
    });
    return shareManager;
}
/**
 *  肿瘤疾病细分列表
 *
 *  @param name     名称
 *  @param complete 回调
 */
- (void) requestDiseaseSubdivisionWithDiseaseID:(NSString *)id Complete: (void(^)(id responseData))complete {
    
    NSDictionary *params = @{@"page":@"1",
                             @"page_size":@"15",
                             @"ci1_id":id,
                             @"keyword":@""};
    
    XFNetWorkManager *manager = [XFNetWorkManager shareManager];
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
    
    [manager POST:@"http://iosapi.itcast.cn/doctor/searchCI3List.json.php" parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary*  responseObject) {
        
        NSArray *data = responseObject[@"data"];
        
        NSArray *response = [XFDiseaseSubdivisionModel mj_objectArrayWithKeyValuesArray:data];
        
        complete(response);
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"%@",error);
        
    }];

}
/**
 *  获取症状列表
 *
 *  @param id       疾病id
 *  @param complete 回调
 */
-(void) requestSymptomWithID:(NSString*)id Complete:(void(^)(id responseData))complete {
    
    


}

@end
